package Loop;

import java.util.*;

/**
 * Enjoy programming!!!
 * 时间： 2021/10/22 -  15:01
 */
public class While {
    public static void main(String[] args){
        System.out.println("用空格（或回车）做分隔符，输入若干个数，最后输入#号结束，然后输入回车确认");
        Scanner reader = new Scanner(System.in);
        double sum = 0;
        int m = 0;
        while(reader.hasNextDouble()){
            double x = reader.nextDouble();
            m++;
            sum += x;
        }
        System.out.println(m + "个数和为" + sum);
        System.out.println(m + "个数平均数为" + sum/m);
    }
}
